package com.example.tnot.Teacher.MinePart.InternalFragment.AboutStu;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;

import androidx.navigation.NavController;
import androidx.navigation.Navigation;

import com.example.tnot.R;
import com.example.tnot.Teacher.BaseFragment.BaseBackFragment;
import com.example.tnot.Teacher.MinePart.InternalFragment.AboutStu.itembean.Student;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText;

public class StuAddFragment extends BaseBackFragment {

    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    ImageButton ib_back;
    MaterialButton btn_complete;
    TextInputEditText et_name,et_StudentId,et_Phone,et_Class;

    private String mParam1;
    private String mParam2;

    public StuAddFragment() {
        // Required empty public constructor
    }

    public static StuAddFragment newInstance(String param1, String param2) {
        StuAddFragment fragment = new StuAddFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }


    @SuppressLint("MissingInflatedId")
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view =inflater.inflate(R.layout.mine_add_stu_fragment, container, false);
        ib_back = view.findViewById(R.id.back);
        btn_complete = view.findViewById(R.id.mb_complete);
        et_Class = view.findViewById(R.id.et_Class);
        et_name = view.findViewById(R.id.et_name);
        et_Phone = view.findViewById(R.id.et_Phone);
        et_StudentId = view.findViewById(R.id.et_StudentId);

        ib_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                NavController navController = Navigation.findNavController(v);
                navController.navigateUp();
            }
        });
        btn_complete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = et_name.getText().toString();
                String StudentId = et_StudentId.getText().toString();
                String Phone = et_Phone.getText().toString();
                String Class = et_Class.getText().toString();
                Student student = new Student(name,StudentId,Phone,Class);

            }
        });

        return view;
    }

}